import 'package:flutter/material.dart';
import 'package:flutter_cwhisky/common/style/colors.dart';
import 'package:flutter_cwhisky/common/style/images.dart';
import 'package:flutter_cwhisky/component/app_bar/tools_bar.dart';
import 'package:flutter_cwhisky/component/base/base_state_less_view.dart';
import 'package:flutter_cwhisky/component/image_view.dart';
import 'package:flutter_cwhisky/component/ink/ink_well_custom.dart';
import 'package:flutter_cwhisky/component/text_view.dart';
import 'package:flutter_cwhisky/routes/route.dart';
import 'package:flutter_cwhisky/utils/log_utils.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

import 'mine_logic.dart';

class MinePage extends BaseStateLessView<MineLogic> {
  const MinePage({super.key});

  @override
  Widget buildContent(BuildContext context) {
    return Scaffold(
      appBar: ToolsBar(
        title: '我的',
        actions: [],
      ),
      body: NestedScrollView(
        physics: const BouncingScrollPhysics(),
        controller: controller.scrollController,
        headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
          return [_buildInfo()];
        },
        body: _buildBody(),
      ),
    );
  }

  _buildBody() {
    return Container(
      height: 500,
      color: AppColors.red,
    );
  }

  _buildInfo() {
    return SliverToBoxAdapter(
      child: Container(
        margin: EdgeInsets.symmetric(horizontal: 16.w),
        child: InkWellCustom(
          child: Row(
            children: [
              ImageView(
                url: AppImages.loadingIdle,
                height: 54.r,
                width: 54.r,
                radius: 100,
              ),
              Container(
                margin: EdgeInsets.only(left: 8.w),
                child: Column(
                  mainAxisSize: MainAxisSize.min,
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    TextView(
                      text: "点击登录",
                      fontSize: 18.sp,
                      fontColor: AppColors.color33,
                      fontWeight: FontWeight.w500,
                    ),
                    TextView(
                      text: "欢迎来到中威网",
                      fontSize: 14.sp,
                      fontColor: AppColors.color99,
                    ),
                  ],
                ),
              )
            ],
          ),
          onTap: () {
            RouteHelper.toLogin();
          },
        ),
      ),
    );
  }
}
